import { CLEAR_NOTICE, NEW_ACTIVITY, CANCEL_ACTIVITY, CHOOSE_STORE, CHOOSE_TIME, CLEAR_STORE_AND_TIME, SEND_MSG } from './actionTypes'

/**
 * 清空消息
 */
export const clearNotice = () => ({
  type: CLEAR_NOTICE
})

/**
 * 发起活动
 * @param {*} id 
 */
export const newActivity = (activity) => ({
  type: NEW_ACTIVITY,
  payload: {
    activity: activity
  }
})

/**
 * 取消活动
 */
export const cancelActivity = (id) => ({
  type: CANCEL_ACTIVITY,
  payload: {
    id: id
  }
})

/**
 * 选择门店
 * @param {Object} store 门店信息
 * @param {Number} type 操作类型： 0 发起活动 1 选择现有活动
 */
export const chooseStore = (store, type) =>({
  type: CHOOSE_STORE,
  payload: {
    currentStore: store,
    actionType: type
  }
})

/**
 * 选择场次
 */

export const chooseGameTime = (field, game, mode) =>({
  type: CHOOSE_TIME,
  payload: {
    game: game,
    mode: mode,
    field: field
  }
})

/**
 * 清空门店、场次选择
 */
export const clearStoreAndTime = () =>({
  type: CLEAR_STORE_AND_TIME
})

/**
 * 清空门店、场次选择
 */
export const sendMsg = (msg) =>({
  type: SEND_MSG,
  payload: {
    msg: msg
  }
})